package com.zwr.mvpdemo;

import com.zwr.mvpdemo.base.BasePresenter;
import com.zwr.mvpdemo.bean.User;
import io.reactivex.functions.Consumer;

public class MainPresenter extends BasePresenter<MainActivity> {

    private final MainManger mainManger = new MainManger();


    private MainInterface mainView;

    public MainPresenter (MainInterface mainView){
        this.mainView = mainView;
    }

    public void startLogin(String name,String pwd){

        mainView.show();
         mainManger.login(name, pwd)
         .subscribe(new Consumer<User>() {
            @Override
            public void accept(User user) throws Exception {

            }
        }, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable throwable) throws Exception {
             mainView.dis();
            }
        });
    }

}
